from selenium import webdriver
from selenium.webdriver.common.by import By
import time


driver = webdriver.Edge()

url = "https://www.baidu.com/"

driver.get(url)

# Css定位元素
# driver.find_element(By.CSS_SELECTOR,"#kw").send_keys("美女")
# driver.find_element(By.CSS_SELECTOR,"[name='wd']").send_keys("lyr")

# Xpath定位元素
driver.find_element(by=By.XPATH,value="//*[@id='kw']").send_keys("lyr")
time.sleep(2)
driver.find_element(by=By.XPATH,value="//*[@id='su']").click()

time.sleep(3)

driver.quit()